<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>登录</title>
    <link rel="stylesheet" href="/index1.css">
</head>
<body>
    <div class="container">
        <div class="top">
            <img src="/1.png" alt="">
            <p class="top-title">用户名密码登录</p>
       </div>
        <form method="post"  action="/login">
            <p class="name">
               <input type="text" name="username" placeholder="手机号/用户名/邮箱" id="name">
            </p>
            <p class="pass">
                <input type="password" name="password" id="pass" placeholder="密码">
            </p>
                <select name="" id="sel">
                    <option value="">---请选择保存时间---</option>
                    <option value="0">不保存</option>
                    <option value="1">保存1天</option>
                    <option value="7">保存7天</option>
                    <option value="30">保存一个月</option>
                </select>
            <input type="submit" value="登录" class="btn" onclick="getMesg()">
            <a href="" class="pass1">忘记密码</a>
            <a href="" class="login">短信快捷登录</a>
        </form>
    </div>
</body>
<script src="/js/jquery.js"></script>
<script src="/js/js.cookie.js"></script>
<script>
    // sel.onchange=function(){
    //     var sel=document.getElementById('sel');
    //     var index=sel.selectedIndex;
    //     var num =sel.option[index].value;
    //     return num;
    // }
    if(Cookies.get('username')!=undefined){
        document.getElementById('name').value=Cookies.get('username');
    }
     if(Cookies.get('password')!=undefined){
        document.getElementById('pass').value=Cookies.get('password');
    }

    function getMesg(){
        var num =Number($('select option:selected').val());
        console.log(num);
        var username=$('#name').val();
        var password= $('#pass').val();
        Cookies.set('username',username,{expires:num})
        Cookies.set('password',password,{expires:num})
    }
</script>
</html>